package com.liuxl.core.common.log;

import ch.qos.logback.core.Context;
import ch.qos.logback.core.spi.PropertyDefiner;
import ch.qos.logback.core.status.Status;

public class PathLogDefiner implements PropertyDefiner{
	
	private static String OS = System.getProperty("os.name").toLowerCase();
	public static boolean isLinux(){
        return OS.indexOf("linux")>=0;
    }
	public static boolean isWindows(){
        return OS.indexOf("windows")>=0;
    }
	@Override
	public String getPropertyValue() {
		// TODO Auto-generated method stub
		String logpath = ""; //
		if(isLinux()) {
			logpath = "/home/log";
		}else if(isWindows()){
			logpath = "C:\\log";
		}else {
			logpath = "/log";
		}
		System.out.println("system.os:"+OS);
		System.out.println("log path:"+logpath);
		return logpath;
	}
	
	@Override
	public void setContext(Context context) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Context getContext() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void addStatus(Status status) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addInfo(String msg) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addInfo(String msg, Throwable ex) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addWarn(String msg) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addWarn(String msg, Throwable ex) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addError(String msg) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addError(String msg, Throwable ex) {
		// TODO Auto-generated method stub
		
	}
	
	
	
	
	public static void main(String[] args) {
		String s = System.getProperty("os.name").toLowerCase();
		System.out.println(s);
	}
	
	
}
